package com.stupro.cjlu.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.stupro.cjlu.entity.Course;
import com.stupro.cjlu.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CourseDAO extends BaseDAO {

    @Autowired
    private CourseMapper courseMapper;

    public int getCourseCountByTeacherId(int teacherId){
        LambdaQueryWrapper<Course> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Course::getTeaID,teacherId);
        return courseMapper.selectCount(wrapper);
    }

    public int delById(int id) {
        return courseMapper.deleteById(id);
    }
}
